<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('Spu/index')}">商品管理</a></li>
        <li><a href="{:url('Spu/add')}">商品添加</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="get" action="{:url('Spu/index')}">
        <input type="text" class="form-control" name="keyword" style="width: 200px;" value="{:input('request.keyword/s','')}" placeholder="请输入商品名">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:url('Spu/index')}">清空</a>
    </form>
    <form method="post" class="js-ajax-form margin-top-20" action="{:url('Spu/order')}">
        <div class="table-actions">
            <button class="btn btn-sm btn-primary js-ajax-submit" type="submit">排序</button>
        </div>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="16"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
                <th width="50">{:lang('SORT')}</th>
                <th width="50">ID</th>
                <th>图片</th>
                <th>商品名称</th>
                <th>图片集</th>
                <th>分类</th>
                <th>状态</th>
                <th>运费</th>
                <th>是否显示</th>
                <th>是否自营</th>
                <th>创建时间</th>
                <th>修改时间</th>
                <th width="120">{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <volist name="newsList" id="v">
                <tr>
                    <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$v.id}"></td>
                    <td><input name="list_orders[{$v.id}]" class="input input-order mr5" type="text" style="width: 50px;" value="{$v.list_order}"></td>
                    <td>{$v.id}</td>
                    <td><img src="/upload/{$v.image}" class="img-thumbnail" onclick="imagePreviewDialog(this.src)" style="width: 80px;"></td>
                    <td>{$v.name}</td>
                    <td>
                        <foreach name="$v['images']" item="img">
                            <img src="/upload/{$img}" class="img-thumbnail" onclick="imagePreviewDialog(this.src)" style="width: 80px;">
                        </foreach>
                    </td>
                    <td>{$v.spu.name|default="查询失败"}</td>
                    <td>
                        <switch name="$v.status">
                            <case value="0">
                                <span class="btn btn-success btn-xs">无货</span>
                            </case>
                            <case value="1">
                                <span class="btn btn-warning btn-xs">正常</span>
                            </case>
                            <case value="2">
                                <span class="btn btn-danger btn-xs">下架</span>
                            </case>
                        </switch>
                    </td>
                    <td>{$v.rmb}</td>
                    <td>
                        <eq name="$v.switch" value="1">
                            <button  type="button" class="btn btn-success toggle-switch" data-id="{$v.id}"><a href="{:url('Spu/show',array('id'=>$v.id))}" class="js-ajax-dialog-btn" data-msg="确定切换是否显示吗？">是</a></button>
                            <else/>
                            <button  type="button" class="btn btn-danger toggle-switch" data-id="{$v.id}"><a href="{:url('Spu/show',array('id'=>$v.id))}" class="js-ajax-dialog-btn" data-msg="确定切换是否显示吗？">否</a></button>
                        </eq>
                    </td>
                    <td>
                        <switch name="$v.zy">
                            <case value="0">
                                <span class="btn btn-success btn-xs">自营店</span>
                            </case>
                            <case value="1">
                                <span class="btn btn-success btn-xs">旗舰店</span>
                            </case>
                        </switch>
                    </td>
                    <td>{$v.create_time}</td>
                    <td>{$v.update_time}</td>
                    <td>

                        <div class="btn-group" role="group">
                            <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                商品配置<span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu">
                                <li>
                                    <a href="javascript:void(0);" onclick="openIframeLayer('setGoodsAttr?spu_id={$v.id}','配置商品属性',{area: ['60%','80%']})">配置属性</a>
                                </li>
                                <li>
                                    <a href="javascript:void(0);" onclick="openIframeLayer('setGoodsAttrValue?spu_id={$v.id}','配置商品属性值',{area: ['60%','80%']})">配置属性值</a>
                                </li>
                                <li>
                                    <a href="javascript:void(0);" onclick="openIframeLayer('setGoodsAttrs?spu_id={$v.id}','配置商品属性值',{area: ['60%','80%']})">配置属性值</a>
                                </li>
                            </ul>

                        </div>

                        <a class="btn btn-xs btn-primary" href="{:url('Spu/edit',array('id'=>$v.id))}">{:lang('EDIT')}</a>
                        <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('Spu/delete',array('id'=>$v.id))}">{:lang('DELETE')}</a>
                    </td>
                </tr>
            </volist>
            </tbody>
        </table>
        <div class="pagination">
            {$page}
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
</body>
</html>
